package com.commpany.servie.basic.promotion.converter;

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;
import com.commpany.servie.basic.promotion.model.dto.promotion.PromotionDTO;
import com.commpany.servie.basic.promotion.po.PromotionPO;

/**
 * DTO和PO相互转换工具类
 * 
 * @author test
 * @date 2020-01-02 17:36:47
 */
public class PromotionConverter {
	
	public static PromotionDTO toDTO(PromotionPO src) {
	if(src==null) return null;
		PromotionDTO  tar = new PromotionDTO();
		tar.setId(src.getId());
		tar.setActiveName(src.getActiveName());
		return tar;
	}

	public static PromotionPO toPO(PromotionDTO src) {
	if(src==null) return null;
		PromotionPO  tar = new PromotionPO();
		tar.setId(src.getId());
		tar.setActiveName(src.getActiveName());
		return tar;
	}

	public static List<PromotionDTO> toDTO(List<PromotionPO> srcs) {
		if (srcs == null)
			return null;
		List<PromotionDTO> list = new ArrayList<PromotionDTO>();
		for (PromotionPO src : srcs) {
			list.add(toDTO(src));
		}
		return list;
	}

	public static List<PromotionPO> toPO(List<PromotionDTO> srcs) {
		if (srcs == null)
			return null;
		List<PromotionPO> list = new ArrayList<PromotionPO>();
		for (PromotionDTO src : srcs) {
			list.add(toPO(src));
		}
		return list;
	}
}
	